<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>我的等级 - 社交平台</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #6366f1;
            --primary-dark: #4f46e5;
            --secondary: #ec4899;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --text-tertiary: #94a3b8;
            --bg-light: #f1f5f9;
            --bg-white: #ffffff;
            --border-light: #e2e8f0;
            --radius: 12px;
            --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 60px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--primary);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }
        
        .nav-title {
            font-size: 18px;
            font-weight: 600;
            color: white;
            text-align: center;
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        .nav-btn {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: none;
            border: none;
            color: white;
            font-size: 20px;
        }
        
        /* 等级卡片样式1 - 主卡片 */
        .level-card-primary {
            background: linear-gradient(135deg, var(--primary), var(--primary-dark));
            color: white;
            border-radius: var(--radius);
            padding: 24px 16px;
            margin: 16px;
            box-shadow: var(--shadow);
            position: relative;
            overflow: hidden;
            text-align: center;
        }
        
        .level-card-primary::before {
            content: '';
            position: absolute;
            top: -40px;
            right: -40px;
            width: 140px;
            height: 140px;
            background-color: rgba(255, 255, 255, 0.1);
            border-radius: 50%;
        }
        
        .level-badge {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.2);
            margin: 0 auto 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 40px;
            position: relative;
            z-index: 1;
            border: 3px solid rgba(255, 255, 255, 0.3);
        }
        
        .current-level {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 8px;
            position: relative;
            z-index: 1;
        }
        
        .level-name {
            font-size: 18px;
            opacity: 0.9;
            margin-bottom: 20px;
            position: relative;
            z-index: 1;
        }
        
        /* 经验值进度 */
        .exp-progress-container {
            background-color: rgba(255, 255, 255, 0.2);
            border-radius: 12px;
            height: 10px;
            margin-bottom: 10px;
            overflow: hidden;
            position: relative;
            z-index: 1;
        }
        
        .exp-progress {
            background-color: var(--secondary);
            height: 100%;
            border-radius: 12px;
            width: 72%;
            transition: width 0.5s ease;
        }
        
        .exp-text {
            font-size: 14px;
            opacity: 0.9;
            position: relative;
            z-index: 1;
        }
        
        /* 等级数据概览 */
        .level-stats {
            display: flex;
            justify-content: space-around;
            background-color: var(--bg-white);
            border-radius: var(--radius);
            margin: 0 16px 16px;
            padding: 16px;
            box-shadow: var(--shadow);
        }
        
        .stat-item {
            text-align: center;
            flex: 1;
        }
        
        .stat-value {
            font-size: 20px;
            font-weight: 700;
            color: var(--primary);
            margin-bottom: 4px;
        }
        
        .stat-label {
            font-size: 12px;
            color: var(--text-secondary);
        }
        
        /* 通用区块样式 */
        .section {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            margin: 0 16px 16px;
            overflow: hidden;
            box-shadow: var(--shadow);
        }
        
        .section-header {
            padding: 16px;
            border-bottom: 1px solid var(--border-light);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .section-title {
            font-size: 17px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .section-more {
            font-size: 13px;
            color: var(--text-tertiary);
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        /* 等级列表样式2 - 垂直进度 */
        .level-list-vertical {
            padding: 8px 0;
        }
        
        .level-item-vertical {
            padding: 12px 16px;
            display: flex;
            align-items: center;
            position: relative;
        }
        
        .level-item-vertical:not(:last-child)::after {
            content: '';
            position: absolute;
            left: 18px;
            top: 40px;
            bottom: -12px;
            width: 2px;
            background-color: var(--border-light);
            z-index: 1;
        }
        
        .level-number {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 15px;
            font-weight: 600;
            margin-right: 16px;
            z-index: 2;
        }
        
        .level-current {
            background-color: var(--primary);
            color: white;
            border: 3px solid rgba(99, 102, 241, 0.2);
        }
        
        .level-locked {
            background-color: var(--bg-light);
            color: var(--text-tertiary);
            border: 3px solid transparent;
        }
        
        .level-unlocked {
            background-color: var(--bg-white);
            color: var(--primary);
            border: 3px solid rgba(99, 102, 241, 0.1);
        }
        
        .level-info {
            flex: 1;
        }
        
        .level-title {
            font-size: 16px;
            font-weight: 500;
            margin-bottom: 2px;
        }
        
        .level-requirement {
            font-size: 13px;
            color: var(--text-tertiary);
        }
        
        .level-reward {
            font-size: 13px;
            color: var(--success);
            font-weight: 500;
        }
        
        /* 等级特权样式3 - 图标网格 */
        .privileges-grid {
            padding: 16px;
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 16px;
        }
        
        .privilege-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            padding: 12px 8px;
            border-radius: var(--radius);
        }
        
        .privilege-icon {
            width: 50px;
            height: 50px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            margin-bottom: 8px;
        }
        
        .privilege-unlocked {
            background-color: rgba(99, 102, 241, 0.1);
            color: var(--primary);
        }
        
        .privilege-locked {
            background-color: var(--bg-light);
            color: var(--text-tertiary);
        }
        
        .privilege-name {
            font-size: 13px;
            font-weight: 500;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        
        /* 等级任务 */
        .level-task-list {
            padding: 8px 0;
        }
        
        .level-task-item {
            padding: 14px 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--border-light);
        }
        
        .level-task-item:last-child {
            border-bottom: none;
        }
        
        .task-info {
            display: flex;
            align-items: center;
            gap: 14px;
        }
        
        .task-icon {
            width: 44px;
            height: 44px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
        }
        
        .task-exp {
            background-color: rgba(16, 185, 129, 0.1);
            color: var(--success);
        }
        
        .task-details {
            flex: 1;
        }
        
        .task-title {
            font-size: 16px;
            font-weight: 500;
            margin-bottom: 3px;
        }
        
        .task-desc {
            font-size: 13px;
            color: var(--text-tertiary);
        }
        
        .task-action {
            font-size: 14px;
            padding: 6px 14px;
            border-radius: 20px;
            font-weight: 500;
        }
        
        .task-complete {
            background-color: var(--bg-light);
            color: var(--text-tertiary);
            border: none;
        }
        
        .task-do {
            background-color: var(--primary);
            color: white;
            border: none;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 60px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: var(--text-tertiary);
            font-size: 11px;
            gap: 4px;
            text-decoration: none;
            flex: 1;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        .nav-icon {
            font-size: 20px;
        }
        
        /* 提示消息 */
        .toast {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 6px;
            z-index: 9999;
            font-size: 14px;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast.show {
            opacity: 1;
        }
        
        /* 升级弹窗 */
        .level-up-modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.7);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 2000;
        }
        
        .level-up-modal.active {
            display: flex;
        }
        
        .modal-content {
            background-color: white;
            border-radius: var(--radius);
            padding: 28px 20px;
            text-align: center;
            width: 88%;
            max-width: 380px;
            position: relative;
            animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }
        
        @keyframes popIn {
            0% { transform: scale(0.8); opacity: 0; }
            80% { transform: scale(1.05); }
            100% { transform: scale(1); opacity: 1; }
        }
        
        .modal-badge {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 40px;
            margin: 0 auto 20px;
            border: 4px solid white;
            box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
        }
        
        .modal-title {
            font-size: 24px;
            font-weight: 700;
            margin-bottom: 10px;
        }
        
        .modal-desc {
            font-size: 15px;
            color: var(--text-secondary);
            margin-bottom: 22px;
        }
        
        .reward-list {
            background-color: var(--bg-light);
            border-radius: 10px;
            padding: 14px;
            margin-bottom: 22px;
            text-align: left;
        }
        
        .reward-title {
            font-size: 15px;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--primary);
        }
        
        .reward-item {
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
        }
        
        .reward-item:last-child {
            margin-bottom: 0;
        }
        
        .reward-icon {
            color: var(--success);
            font-size: 16px;
        }
        
        .modal-btn {
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 24px;
            padding: 10px 0;
            width: 100%;
            font-weight: 600;
            font-size: 16px;
            transition: background-color 0.2s;
        }
        
        .modal-btn:hover {
            background-color: var(--primary-dark);
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-btn" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">我的等级</div>
        <button class="nav-btn" id="levelHelpBtn">
            <i class="fas fa-question-circle"></i>
        </button>
    </div>
    
    <!-- 主等级卡片 -->
    <div class="level-card-primary">
        <div class="level-badge">
            <i class="fas fa-diamond"></i>
        </div>
        <div class="current-level">Lv.8</div>
        <div class="level-name">钻石会员</div>
        <div class="exp-progress-container">
            <div class="exp-progress"></div>
        </div>
        <div class="exp-text">当前经验值: 1,720/2,500 (距离下一级还需780经验)</div>
    </div>
    
    <!-- 等级数据概览 -->
    <div class="level-stats">
        <div class="stat-item">
            <div class="stat-value">8</div>
            <div class="stat-label">当前等级</div>
        </div>
        <div class="stat-item">
            <div class="stat-value">12</div>
            <div class="stat-label">总等级数</div>
        </div>
        <div class="stat-item">
            <div class="stat-value">42</div>
            <div class="stat-label">已解锁特权</div>
        </div>
        <div class="stat-item">
            <div class="stat-value">15</div>
            <div class="stat-label">连续活跃(天)</div>
        </div>
    </div>
    
    <!-- 等级进度列表 -->
    <div class="section">
        <div class="section-header">
            <div class="section-title">
                <i class="fas fa-route" style="color: var(--primary);"></i>
                等级进度
            </div>
            <a href="#" class="section-more">
                <span>全部等级</span>
                <i class="fas fa-chevron-right" style="font-size: 12px;"></i>
            </a>
        </div>
        <div class="level-list-vertical">
            <div class="level-item-vertical">
                <div class="level-number level-unlocked">6</div>
                <div class="level-info">
                    <div class="level-title">黄金会员</div>
                    <div class="level-requirement">已达成 · 500经验值</div>
                </div>
                <div class="level-reward">+12特权</div>
            </div>
            <div class="level-item-vertical">
                <div class="level-number level-unlocked">7</div>
                <div class="level-info">
                    <div class="level-title">铂金会员</div>
                    <div class="level-requirement">已达成 · 1000经验值</div>
                </div>
                <div class="level-reward">+8特权</div>
            </div>
            <div class="level-item-vertical">
                <div class="level-number level-current">8</div>
                <div class="level-info">
                    <div class="level-title">钻石会员</div>
                    <div class="level-requirement">当前等级 · 1720/2500经验值</div>
                </div>
                <div class="level-reward">+15特权</div>
            </div>
            <div class="level-item-vertical">
                <div class="level-number level-locked">9</div>
                <div class="level-info">
                    <div class="level-title">星耀会员</div>
                    <div class="level-requirement">未达成 · 5000经验值</div>
                </div>
                <div class="level-reward">+10特权</div>
            </div>
            <div class="level-item-vertical">
                <div class="level-number level-locked">10</div>
                <div class="level-info">
                    <div class="level-title">王者会员</div>
                    <div class="level-requirement">未达成 · 10000经验值</div>
                </div>
                <div class="level-reward">+18特权</div>
            </div>
        </div>
    </div>
    
    <!-- 等级特权网格 -->
    <div class="section">
        <div class="section-header">
            <div class="section-title">
                <i class="fas fa-crown" style="color: var(--secondary);"></i>
                等级特权
            </div>
            <a href="#" class="section-more">
                <span>全部特权</span>
                <i class="fas fa-chevron-right" style="font-size: 12px;"></i>
            </a>
        </div>
        <div class="privileges-grid">
            <div class="privilege-card">
                <div class="privilege-icon privilege-unlocked">
                    <i class="fas fa-image"></i>
                </div>
                <div class="privilege-name">高清图片上传</div>
            </div>
            <div class="privilege-card">
                <div class="privilege-icon privilege-unlocked">
                    <i class="fas fa-ad"></i>
                </div>
                <div class="privilege-name">无广告体验</div>
            </div>
            <div class="privilege-card">
                <div class="privilege-icon privilege-unlocked">
                    <i class="fas fa-pin"></i>
                </div>
                <div class="privilege-name">内容置顶</div>
            </div>
            <div class="privilege-card">
                <div class="privilege-icon privilege-unlocked">
                    <i class="fas fa-star"></i>
                </div>
                <div class="privilege-name">专属标识</div>
            </div>
            <div class="privilege-card">
                <div class="privilege-icon privilege-locked">
                    <i class="fas fa-shield-alt"></i>
                </div>
                <div class="privilege-name">账号保护</div>
            </div>
            <div class="privilege-card">
                <div class="privilege-icon privilege-locked">
                    <i class="fas fa-gift"></i>
                </div>
                <div class="privilege-name">月度礼包</div>
            </div>
        </div>
    </div>
    
    <!-- 等级任务 -->
    <div class="section">
        <div class="section-header">
            <div class="section-title">
                <i class="fas fa-tasks" style="color: var(--success);"></i>
                升级任务
            </div>
            <a href="#" class="section-more">
                <span>更多任务</span>
                <i class="fas fa-chevron-right" style="font-size: 12px;"></i>
            </a>
        </div>
        <div class="level-task-list">
            <div class="level-task-item">
                <div class="task-info">
                    <div class="task-icon task-exp">
                        <i class="fas fa-sign-in-alt"></i>
                    </div>
                    <div class="task-details">
                        <div class="task-title">连续登录7天</div>
                        <div class="task-desc">已连续登录15天，可领取额外奖励</div>
                    </div>
                </div>
                <button class="task-action task-do" data-task="连续登录" data-exp="+150">领取奖励</button>
            </div>
            <div class="level-task-item">
                <div class="task-info">
                    <div class="task-icon task-exp">
                        <i class="fas fa-pen"></i>
                    </div>
                    <div class="task-details">
                        <div class="task-title">发布优质内容</div>
                        <div class="task-desc">发布3篇获得10+点赞的内容</div>
                    </div>
                </div>
                <button class="task-action task-do" data-task="发布内容" data-exp="+300">去完成</button>
            </div>
            <div class="level-task-item">
                <div class="task-info">
                    <div class="task-icon task-exp">
                        <i class="fas fa-users"></i>
                    </div>
                    <div class="task-details">
                        <div class="task-title">邀请好友</div>
                        <div class="task-desc">成功邀请3位新用户注册</div>
                    </div>
                </div>
                <button class="task-action task-do" data-task="邀请好友" data-exp="+500">去完成</button>
            </div>
            <div class="level-task-item">
                <div class="task-info">
                    <div class="task-icon task-exp">
                        <i class="fas fa-comments"></i>
                    </div>
                    <div class="task-details">
                        <div class="task-title">社区互动</div>
                        <div class="task-desc">发表20条优质评论</div>
                    </div>
                </div>
                <button class="task-action task-complete">已完成</button>
            </div>
        </div>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home nav-icon"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass nav-icon"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-medal nav-icon"></i>
            <span>等级</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-user nav-icon"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- 升级弹窗 -->
    <div class="level-up-modal" id="levelUpModal">
        <div class="modal-content">
            <div class="modal-badge">
                <i class="fas fa-crown"></i>
            </div>
            <div class="modal-title">恭喜升级！</div>
            <div class="modal-desc">您已升级至 Lv.9 星耀会员</div>
            <div class="reward-list">
                <div class="reward-title">新解锁特权：</div>
                <div class="reward-item">
                    <i class="fas fa-check reward-icon"></i>
                    <span>账号安全保护升级</span>
                </div>
                <div class="reward-item">
                    <i class="fas fa-check reward-icon"></i>
                    <span>每月可领取专属礼包</span>
                </div>
                <div class="reward-item">
                    <i class="fas fa-check reward-icon"></i>
                    <span>内容优先推荐权益</span>
                </div>
            </div>
            <button class="modal-btn" id="closeModal">领取奖励</button>
        </div>
    </div>
    
    <!-- 提示消息 -->
    <div class="toast" id="toast"></div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // DOM元素
        const backBtn = document.getElementById('backBtn');
        const levelHelpBtn = document.getElementById('levelHelpBtn');
        const taskButtons = document.querySelectorAll('.task-do');
        const toast = document.getElementById('toast');
        const expProgress = document.querySelector('.exp-progress');
        const expText = document.querySelector('.exp-text');
        const currentLevel = document.querySelector('.current-level');
        const levelUpModal = document.getElementById('levelUpModal');
        const closeModal = document.getElementById('closeModal');
        
        // 当前经验值数据
        let currentExp = 1720;
        const maxExp = 2500;
        let level = 8;
        
        // 显示提示消息
        function showToast(message) {
            toast.textContent = message;
            toast.classList.add('show');
            
            clearTimeout(toast.timeout);
            toast.timeout = setTimeout(() => {
                toast.classList.remove('show');
            }, 2000);
        }
        
        // 更新经验值显示
        function updateExpDisplay() {
            const percentage = (currentExp / maxExp) * 100;
            expProgress.style.width = `${percentage}%`;
            
            const remainingExp = maxExp - currentExp;
            expText.textContent = `当前经验值: ${currentExp.toLocaleString()}/${maxExp.toLocaleString()} (距离下一级还需${remainingExp}经验)`;
            
            // 检查是否升级
            if (currentExp >= maxExp) {
                levelUp();
            }
        }
        
        // 等级提升处理
        function levelUp() {
            level++;
            currentExp = currentExp - maxExp;
            // 更新等级显示
            currentLevel.textContent = `Lv.${level}`;
            
            // 显示升级弹窗
            levelUpModal.classList.add('active');
        }
        
        // 绑定事件
        function bindEvents() {
            // 返回按钮
            backBtn.addEventListener('click', () => {
                history.back();
                showToast('返回上一页');
            });
            
            // 帮助按钮
            levelHelpBtn.addEventListener('click', () => {
                showToast('等级规则说明');
            });
            
            // 任务按钮点击
            taskButtons.forEach(btn => {
                btn.addEventListener('click', function() {
                    const taskName = this.getAttribute('data-task');
                    const exp = parseInt(this.getAttribute('data-exp'));
                    
                    // 更新按钮状态为已完成
                    this.textContent = '已完成';
                    this.classList.remove('task-do');
                    this.classList.add('task-complete');
                    this.disabled = true;
                    
                    // 显示提示
                    showToast(`完成${taskName}，获得${exp}经验值`);
                    
                    // 更新经验值
                    currentExp += exp;
                    updateExpDisplay();
                });
            });
            
            // 关闭升级弹窗
            closeModal.addEventListener('click', () => {
                levelUpModal.classList.remove('active');
                showToast('恭喜升级，已领取奖励');
                updateExpDisplay();
            });
        }
        
        // 初始化
        function init() {
            bindEvents();
        }
        
        // 启动
        init();
    </script>
</body>
</html>
